package control;

import java.util.List;

import javax.annotation.Resource;
import javax.persistence.Query;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import bean.Hotel;


@Controller
public class HotelControl {

	@Resource
	Dao dao;
	
	
	@RequestMapping(value="/enregistrerHotel",method=RequestMethod.POST)
	public @ResponseBody Hotel addHotel(String name, String address, String classification){
		System.out.println("addHotel");
		return dao.addHotel(name, address, classification);
	}

	@RequestMapping(value="/suppHotel",method=RequestMethod.GET)		
	public @ResponseBody boolean removeHotel(int idHotel){
		System.out.println("removeHotel");
		return dao.removeHotel(idHotel);
	}

	@RequestMapping(value="/modifiyHotel",method=RequestMethod.GET)		
	public @ResponseBody boolean modifiyHotel(int idxHotel, String name, String address, String classification){
		System.out.println("modifiyHotel");
		return dao.modifiyHotel(idxHotel, name, address, classification);
	}
			
	@RequestMapping(value="/getHotel",method=RequestMethod.GET)	
	public @ResponseBody Hotel getHotel(int idxHotel){
		System.out.println("getHotel");
		return dao.getHotel(idxHotel);		
	}
			
	@RequestMapping(value="/getHotels",method=RequestMethod.GET)			
	public @ResponseBody List<Hotel> getHotels(){
		System.out.println("getHotels");
		return dao.getHotels();
	}
	
	
	
	
	
	
}
